<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
<%@ include file="/WEB-INF/jsp/inc/taglibs.jsp"%>
	<%@ include file="/WEB-INF/jsp/inc/meta.jsp"%>
	
  <script type="text/javascript">
   function checkAll(val){
    //alert(val);
    if(val)
      $('input[name=ids]').each(function(){
           $(this).attr('checked',true);
      })
     else
    	 $('input[name=ids]').each(function(){
             $(this).attr('checked',false);
        })  
   }
   function gotopage()
   {
      var page=$('#topage').val();
      var url='${approot}/admin/logsys/list/page/'+page;
     // alert(url);
      window.location.href=url;
   }
	//清空恢复表单原始数据
   function formreset()
	{
		$("input[type=text]").val(""); 
		$("#type").val("0");
	}

   //批量删除
   function delete_batch(){
    var count=0;
    $('input[name=ids]:checked').each(function(){
        count=count+1;
    })
    if(count==0)
    {
        alert("请至少选中一条记录");
        return false;
    }else
    {
        var ids="";
        $("input[name='ids']:checked").each(function(){
           ids=ids+$(this).val()+"_";
        })
        var url='${approot}/admin/logsys/delete_batch/'+ids;
        //alert(url);
        window.location.href=url;

    }

   }
   
   </script>
</head>  
 <body style="background:#E8F5FE; padding:15px 18px;" class="scroll_r">

<table border="0" cellpadding="" cellspacing="1" align="center" width="92%" id="web_tab">
 <caption style="text-align: right;margin-bottom:4px;"><button class="but" onclick="location.href='${approot}/admin/role/to_add'">添加角色</button>
</caption>
 <tr>
  <th>角色名称</th>
  <th>角色说明</th>
  <th>角色权限</th>
  <th>操作</th>
 </tr>
<c:forEach var="item" items="${page.items}">
 <tr>
  <td>${item.name}</td>
  <td>${item.remark} </td>
 <td>
 <c:if test="${item.rights=='0'}"><font color='red'>未分配</font></c:if>
 <c:if test="${item.rights!='0'}">已分配</c:if>
 </td>
  <td>
  <a href="${approot}/admin/role/delete/${item.id}" onclick="return confirm('删除后不可恢复,确认删除?')">删除</a>
  <a href="${approot}/admin/role/to_edit/${item.id}">修改</a>

   <c:if test="${item.rights=='0'}">
  <a href="${approot}/admin/role/to_add_right/${item.id}">分配权限</a>
  </c:if>
  <c:if test="${item.rights!='0'}">
  <a href="${approot}/admin/role/to_edit_right/${item.id}">分配权限</a>
  </c:if>
   </td>
 </tr>
 </c:forEach>
</table>
<!-- 
<table border="0" cellpadding="0" cellspacing="1" width="92%" align="center">
   <tr>
    <td align="left">共有<font color='red'>${page.totalCount}</font> 条记录，当前第<font color='red'>${page.currentPage}</font>页，共 <font color='red'>${page.pageCount}</font>页</td>
	<td align="right">
	 转到
	 <select name="topage" id="topage" onchange="gotopage();">
	 <c:forEach var="ind" items="${page.pages}">
	 <option value="${(ind-1)*page.pageSize}" <c:if test="${ind==page.currentPage}">selected="selected"</c:if>>${ind}</option>
	 </c:forEach>
	 </select>
	
	<button class="but" onclick="window.location.href='${approot}/admin/logsys/list/page/${page.firstIndex}'">首页</button> 
	<button class="but" onclick="window.location.href='${approot}/admin/logsys/list/page/${page.previousIndex}'">上一页</button>
	<c:forEach items="${page.showpages}" var="ind">
	<c:if test="${ind!=0}">
	<a href="${approot}/admin/logsys/list/page/${(ind-1)*page.pageSize}">${ind}</a>
	</c:if>
	</c:forEach>
	<button class="but" onclick="window.location.href='${approot}/admin/logsys/list/page/${page.nextIndex}'">下一页</button>
	<button class="but" onclick="window.location.href='${approot}/admin/logsys/list/page/${page.lastIndex}'">末页</button>  
	
	 </td>
   </tr>
</table>
 -->
</body>
</html>
